#include "stdafx.h"
#include "TestUeObjectId.h"
#include "UeObjectId.h"

CPPUNIT_TEST_SUITE_REGISTRATION( TestUeObjectId );


TestUeObjectId::TestUeObjectId()
{
}


TestUeObjectId::~TestUeObjectId()
{
}

void TestUeObjectId::TestConstructor()
{
	StdString strTemp("10000\\11");

	UeObjectId id(strTemp);

	CPPUNIT_ASSERT( id.EnviromentID() == 10000 );
	CPPUNIT_ASSERT( id.ObjectID() == 11 );
	
	strTemp = _T("23432\\343");
	UeObjectId id1(strTemp);
	
	CPPUNIT_ASSERT( id1.EnviromentID() == 23432 );
	CPPUNIT_ASSERT( id1.ObjectID() == 343 );
}

void TestUeObjectId::TestToString()
{
	UeObjectId id( 23323, 3434 );

	CPPUNIT_ASSERT( id.ToString() == _T("23323\\3434") );
}

void TestUeObjectId::TestIsNull()
{
	UeObjectId id1;
	
	CPPUNIT_ASSERT( id1.IsNull() );

	UeObjectId id2( 22, 34 );
	CPPUNIT_ASSERT( !id2.IsNull() );

	id1 = id2;
	CPPUNIT_ASSERT( !id1.IsNull() );
}

void TestUeObjectId::TestEqual()
{
	UeObjectId id1;
	UeObjectId id2(34,55);
	UeObjectId id3(34,55);

	CPPUNIT_ASSERT( id1 != id2 );
	CPPUNIT_ASSERT( !(id1 == id2 ) );
	CPPUNIT_ASSERT( id2 == id3 );
	CPPUNIT_ASSERT( !( id2 != id3 ) );
}

void TestUeObjectId::TestEvaluate()
{
	UeObjectId id1;
	UeObjectId id2( 34, 35 );

	id1 = id2;
	CPPUNIT_ASSERT( id1 == id2 );
	CPPUNIT_ASSERT( id1.EnviromentID() == 34 );
	CPPUNIT_ASSERT( id1.ObjectID() == 35 );
}